package com.lx.idgenerator.lifecycle;


/**
 * ID生成器生命周期接口
 */
public interface IIDGeneratorLifecycle {

    enum GeneratorState{
        INIT_STATE(1,"初始状态"),
        START_STATE(2,"开始状态"),
        STOP_STATE(3,"结束状态"),
        DEFAULT_STATE(4,"默认状态");

        private int state;
        private String desc;

        public int getState() {
            return state;
        }

        public void setState(int state) {
            this.state = state;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        GeneratorState(int state, String desc) {
            this.desc = desc;
            this.state = state;
        }

    }


    /**
     *初始化
     */
    void init();

    /**
     *开始
     */
    void start();

    /**
     * 结束
     */
    void stop();

    /**
     * 组件名称
     * @return
     */
    String name();

    /**
     * 获取组件当前状态
     * @return
     */
    GeneratorState getState();
}
